<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/8/24
 * Time: 14:43
 */
namespace app\api\model;

class Banner extends BaseModel {
    protected $hidden = ['delete_time','update_time'];

    /**关联模型，banner关联 banner_itme表
     * @return \think\model\relation\HasMany
     */
    public function items(){
        return $this->hasMany('BannerItem','banner_id','id');
    }

    public static function getBannerByID($id){
        $banner =  self::with(['items','items.img'])->find($id);
        return $banner;
    }


}












